# -*- coding: utf-8 -*-
# @Time       : 2019/7/27 下午8:01
# @Author     : Simon
# @Email      : 
# @File       : mt.py
# @Software   : PyCharm
# @Description:
import datetime
import json
import re
import time
import traceback

import requests
from lxml import etree
from requests.cookies import RequestsCookieJar

from LoggerWarpper import logger

class MTSpider():
    def __init__(self, cookie, ip=None):
        # rd = RedisConnect()
        # ip = rd.get(str(2))
        # logger.info(ip)
        # try:
        #     self.ip = eval(ip)
        # except:
        #     self.ip = ip
        # cookie='wm_order_channel=default; utm_source=; device_uuid=!79746489-eee7-4c0d-9603-4204e438213e; uuid_update=true; _lxsdk_cuid=16c1e0490bbc8-04eeeb64b55f83-37637e05-13c680-16c1e0490bbc8; _lxsdk=16c1e0490bbc8-04eeeb64b55f83-37637e05-13c680-16c1e0490bbc8; uuid=0972c056fcbf72e5717b.1563871711.1.0.0; acctId=31831468; brandId=-1; wmPoiId=3808654; isOfflineSelfOpen=0; city_id=320322; isChain=0; existBrandPoi=false; ignore_set_router_proxy=false; region_id=1000320300; region_version=1522825782; newCategory=false; token=0_kMpCPDeMQOTkj5m42iverf4jdQVDCsaVLv_Tx3BSpY*; logistics_support=1; cityId=130100; provinceId=130000; city_location_id=320300; location_id=320322; pushToken=0_kMpCPDeMQOTkj5m42iverf4jdQVDCsaVLv_Tx3BSpY*; _ga=GA1.3.347801704.1563929791; mtcdn=K; u=52811763; wpush_server_url=wss://wpush.meituan.com; set_info=%7B%22wmPoiId%22%3A3808654%2C%22region_id%22%3A%221000320300%22%2C%22region_version%22%3A1522825782%7D; unc=CRY678131204; lt=PhPYdsCRrkc3k-WGWXrpiUExwKIAAAAA0AgAAJiBP367cPZ2bvGcp12-CmFcnMh4Ftmg22E4yXD-s1QWambaW3LicgnBRetTuvf_BA; n=CRY678131204; __mta=46068379.1563929791304.1564038548325.1564149315757.3; LX_SC_CONSTANT=c_bd35rzn5; _lx_utm=utm_source%3D60066; shopCategory=food; setPrivacyTime=10_20190728; JSESSIONID=6gf8gm2jv43817061daq4tvbk; _lxsdk_s=16c3426f72b-55f-be2-aa2%7C31831468%7C149'
        self.headers = {
            "Accept": "application/json, text/plain, */*",
            "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36",

        }
        if ip:
            self.ip = ip
        else:
            self.ip= {"https": "https://ldy:ldy@123.@120.92.93.91:8888","http": "http://ldy:ldy@123.@120.92.93.91:8888"}
        self.headers['Cookie'] = cookie
        self.cookie=cookie
        self.base_url = 'http://e.waimai.meituan.com'  # 外卖后台地址
        self.api_url='https://waimaieapp.meituan.com'
        self.bussinesstatus_url = self.base_url + '/common/businessStatus'  # 获取商店状态
        self.trend_url = self.api_url + '/bizdata/flowanalysisV3/flow/trendList'  # 获取昨日订单url
        self.exposure_url = self.api_url + '/ad/v4/statistics/cpc/r/today/info'  # 获取当前曝光数
        self.rangeprice_url = self.api_url + 'm/ad/v4/cpc/orientedPromotion/r/priceRange'  # 获取当前出价区间
        self.customer_edit_url = self.api_url + '/ad/v4/cpc/orientedPromotion/w/customer'  # 修改新客定向价格
        self.customer_get_url = self.api_url + '/ad/v4/cpc/orientedPromotion/r/customer'  # 获取新客定向价格
        self.detail_url = self.api_url + '/ad/v4/plan/cpc/r/detail'
        self.ad_status_url = self.api_url + '/ad/v4/plan/cpc/w/status'  # 开启关闭推广URL
        self.ad_overview_url = self.api_url + '/bizdata/flowanalysisV3/flow/overview'  # 获取昨日状态
        self.ad_baseprice_url = self.api_url + '/ad/v2/plan/unit/bid/edit'  # 设置基础出价
        self.ad_blance_url = self.api_url + '/ad/v4/index/r/account/info'  # 获取余额
        self.ad_trendList_url = self.api_url + '/bizdata/flowanalysisV3/flow/trendList'  # 获取客流分析的数据,客流分析
        self.ad_realTime_order = self.base_url + '/v2/index/r/businessOverview'  # 获取实时订单的接口
        self.todayOverView_url = self.api_url + '/bizdata/businessStatisticsV3/single/todayOverview'  # 获取营业额信息
        # https://waimaieapp.meituan.com/bizdata/businessStatisticsV3/single/todayOverview?wmPoiId=3808654
        self.exposure_all_url = self.api_url + '/bizdata/flowanalysisV3/flow/trendList'  # 获取总曝光
        # http: // e.waimai.meituan.com / v2 / order / receive / r / countAndSumOfToday?requestWmPoiId = -1 & region_id = 1000320300 & region_version = 1522825782
        self.realTime_order_url = self.base_url + '/v2/order/receive/r/countAndSumOfToday'
        self.avg_seven_shop_info_usrl = self.api_url + '/ad/v3/statistics/cpc/history/info'
        self.commentSummary_url = self.api_url + '/other/v2/customer/commentSummary'
        self.activityQuery_url = self.api_url + '/reuse/activity/query/agg'
        self.customerManageV3_url = self.api_url + '/bizdata/customerManageV3/single/repeatView'
        self.customerManageV3NewOldView_url = self.api_url + '/bizdata/customerManageV3/single/newOldView'  # 顾客的复购率
        self.commentList_url = self.api_url + '/other/v2/customer/comment/r/list'  # 店铺评论
        self.exposureInfo_url = self.api_url + '/bizdata/flowanalysisV3/flow/exposureInfo'  # 顾客来源

        self.shopRank_url = self.base_url + '/v2/index/r/analysis/rank'  # 商家商圈排名
        self.shopSpuList_url = self.base_url + '/reuse/product/food/r/spuList'  # 查询下架的商品
        self.req = requests.session()
        self.csftoken = None
        self.reqcookie = RequestsCookieJar()
        self.setCookie()
        self.get_csrf_token()
        self.hisOverView_url = self.api_url + '/bizdata/businessStatisticsV3/single/hisOverview'  # 历史营业信息
        self.finance_url = self.api_url + '/finance/pc/api/poiSettleBill/settleBillList'  # 获取实际的营收信息
        self.setBudget_url = self.api_url + "/ad/v4/plan/cpc/w/budget"  # 设置预算
        self.checkLabel_url = self.api_url + "/bizdata/marketing/targetCoupon/checkLabelV2"
    def setCookie(self):
        for c in self.cookie.split(';'):
            try:
                k, v = c.split('=')
                k = k.strip()
                v = v.strip()
                self.reqcookie.set(k, v)
            except:
                logger.debug(c)
                continue

    def get_csrf_token(self):
        self.headers['Accept']='text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3'
        params={
            "region_id":self.reqcookie.get('region_id',""),
            "region_version":self.reqcookie.get('region_version',"")
        }
        resp = self.req.get(self.base_url, params=params, headers=self.headers,cookies=self.reqcookie, proxies=self.ip, verify= False, timeout=2)
        self.reqcookie.update(resp.cookies.get_dict())

        try:
            page = etree.HTML(resp.text)
            self.csftoken=page.xpath("//input[@class='J-csrf-token']/@value")[0]
        except:
            logger.warning(traceback.format_exc())
        logger.info(self.csftoken)
    # def getShopStatus(self):
    #     params = {
    #         "region_id": self.reqcookie['region_id'],
    #         "region_version": self.reqcookie['region_version']
    #
    #     }
    #     self.headers['Referer']=self.base_url
    #     data={
    #         "wmPoiId":self.reqcookie['wmPoiId'],
    #         "csrfToken":self.csftoken
    #     }
    #     resp=self.req.post(self.bussinesstatus_url,params=params,data=data,headers=self.headers, proxies=self.ip, verify= False)#,cookies=self.reqcookie)
    #
    #     logger.info(resp.text)
    #     return resp.json()
    #     #{"restType":0,"status":1,"subStatus":2,"wmPoiStatusDesc":"仅接受预订","code":0,"shippingTimeDesc":"09:00-21:00"}
    #     #{"restType":0,"status":1,"subStatus":0,"wmPoiStatusDesc":"营业中","code":0,"shippingTimeDesc":"09:00-21:00"}
    def getShopStatus(self,ip):
        params = {
            "region_id": self.reqcookie['region_id'],
            "region_version": self.reqcookie['region_version']

        }
        self.headers['Referer']=self.base_url
        data={
            "wmPoiId":self.reqcookie['wmPoiId'],
            "csrfToken":self.csftoken
        }
        if ip:
            self.ip = ip
        resp=self.req.post(self.bussinesstatus_url,params=params,data=data,headers=self.headers, proxies=self.ip, verify= False)#,cookies=self.reqcookie)

        logger.info(resp.text)
        return resp.json()
    def getCurrentOrder(self,daytime):
        ret_data = []
        offset = ""
        get_history_url = "http://e.waimai.meituan.com/v2/order/history/r/query?"
        params_dict = self.get_para_from_mtcookie(self.cookie)
        wmPoiId = params_dict.get('wmPoiId', "")
        region_id = params_dict.get('region_id', "")
        region_version = params_dict.get('region_version', "")
        headers = {
            "Accept": "application/json, text/plain, */*",
            "Sec-Fetch-Mode": "cors",
            "Accept-Language": "zh-CN,zh;q=0.9",
            "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36",
            "X-Requested-With": "XMLHttpRequest",
            "Cookie": self.cookie,
            "Referer": "https://waimaieapp.meituan.com/other/v2/customer/comment"
        }

        name_params = {
            "getNewVo": "1",
            "wmOrderPayType": "2",
            "wmOrderStatus": "-2",
            "sortField": "1",
            "startDate": daytime,
            "endDate": daytime,
            "lastLabel": "",
            "nextLabel": "",
            "requestWmPoiId": wmPoiId,
            "region_id": region_id,
            "region_version": region_version,
            "_token": "eJyrViryTFGyMjQAAnMdpdwQJavoWB2lbCidCKVLoHRmXkFpSTGEnVRaUpKfB+UUZ6bnKVkppXpVhISmezo6uqc7BgXa2irpKCWD1BuamlmaWJgaGRkYW5rWAgCY4yEF"
        }

        while True:
            name_params['nextLabel'] = offset
            hist_str = requests.get(get_history_url.format(offset), params=name_params, headers=headers, proxies=self.ip, verify= False).text
            print(hist_str)
            hist_json = json.loads(hist_str)

            for order in hist_json['wmOrderList']:
                ret_data.append(order['order_time_fmt'])
            if isinstance(hist_json['nextLabel'], dict):
                num = hist_json['nextLabel']['day_seq']
                offset = json.dumps({
                    "day": daytime.replace("-", ""),
                    "day_seq": num,
                    "page": 0,
                    "setDay_seq": "true",
                    "setPage": "false",
                    "setDay": "true"
                })
            else:
                break

        return ret_data

    def checkLabel(self, new_custom_type,begin_time, end_time):

        # new_custom_type = 2时是进店未下单，= 3时是下单未付款
        # begin_time是昨天0点的时间戳,2020-01-05 00：00：00的时间戳

        self.headers.update(dict(
            Referer="https://waimaieapp.meituan.com/igate/bizdata/marketing/createLabel"))
        params = {
            "wmPoiId": self.reqcookie['wmPoiId'],
            "title": "label1",
            "comments" : "label1_comments",
            "begin_time" : begin_time,
            "order_time" : "31",
            "dateType" : "0",
            "is_follow" : "0",
            "new_custom":"1",
            "new_custom_type" : new_custom_type,
            "comment_context":"7",
            "comment_level" : "7",
            "comment":"3",
            "order_day" : "3",
            "fact_order_price_avg":"",
            "hot_lat_long_infos":"",
            "potential_lat_long_infos":"",
            "discount_sensitivity":"",
            "newCustomInt":"3",
            "end_time" : end_time,
        }
        resp = self.req.get(self.checkLabel_url, params=params, headers=self.headers,proxies=self.ip, verify= False)
        logger.info(resp.text)
        try:
            data = resp.json().get("data")
            return data
        except:
            return False


    def getHisOverView(self, beginTime, endTime):
        self.headers.update(dict(
            Referer=self.api_url + "/bizdata?_source=PC&token=" + self.reqcookie['token'] + "&acctId=" +
                    self.reqcookie['acctId'] + "&wmPoiId=" + self.reqcookie['wmPoiId'] + "&region_id=" + self.reqcookie[
                        'region_id'] + "&device_uuid=" + self.reqcookie[
                        'device_uuid'] + "&appType=3&fromPoiChange=false"))
        params = {
            "wmPoiId": self.reqcookie['wmPoiId'],
            "beginTime": beginTime,
            "endTime": endTime,
        }
        resp = self.req.get(self.hisOverView_url, params=params, headers=self.headers, proxies=self.ip, verify= False)
        logger.info(resp.text)
        data = resp.json().get("data", {})
        return data

    def getSettleBillList(self):
        self.headers.update(dict(
            Referer=self.api_url + "/finance/static/gray_html_pc/billReconciliation.html"))
        resp = self.req.get(self.finance_url, headers=self.headers, proxies=self.ip, verify= False)
        logger.info(resp.text)
        data = resp.json().get("data", {})
        return data

    def gettodayExposure(self):
        '''
        获取今天曝光数
        :return:
        '''
        self.headers.update(
            {"Referer":"https://waimaieapp.meituan.com/bizdata/?_source=PC&token=" + self.reqcookie[
            'token'] + "&acctId=" + self.reqcookie['acctId'] + "&wmPoiId=" + self.reqcookie[
                           'wmPoiId'] + "&region_id=" + self.reqcookie['region_id'] + "&appType=3&fromPoiChange=false"
             }
        )
        params = {

            "acctId": self.reqcookie['acctId'],
            "wmPoiId": self.reqcookie['wmPoiId'],
            "token": self.reqcookie['token'],
            "platform": "0",
            "bizad_cityId": self.reqcookie['location_id'],
            "bizad_second_city_id": self.reqcookie['city_location_id'],
            "bizad_third_city_id": self.reqcookie['location_id'],
            "_": int(time.time() * 1000)

        }
        resp=self.req.get(self.exposure_url,params=params,headers=self.headers,cookies=self.reqcookie, proxies=self.ip, verify= False)
        return resp.json()
    def getOverView(self):
        self.headers.update({
            "Referer": "https://waimaieapp.meituan.com/bizdata/?_source=PC&token=" + self.reqcookie[
                'token'] + "&acctId=" + self.reqcookie['acctId'] + "&wmPoiId=" + self.reqcookie[
                           'wmPoiId'] + "&region_id=" + self.reqcookie['region_id'] + "&appType=3&fromPoiChange=false"

        })
        params={
             "wmPoiId": self.reqcookie['wmPoiId'],
            "acctId": self.reqcookie['acctId'],
            "recentDays": 1
        }
        resp=self.req.get(self.ad_overview_url,params=params,headers=self.headers, proxies=self.ip, verify= False)#,cookies=self.reqcookie)

        logger.info(resp.text)
        return resp.json()
    def get_para_from_mtcookie(self, cookie):
        '''
        从美团cookie中获取相应的参数
        :param cookie:
        :return:
        '''
        wmPoiId = re.findall('wmPoiId=(.*?);', cookie, re.S | re.I)[0]
        acctId = re.findall('acctId=(.*?);', cookie, re.S | re.I)[0]
        region_id = re.findall('region_id=(.*?);', cookie, re.S | re.I)[0]
        region_version = re.findall('region_version=(.*?);', cookie, re.S | re.I)[0]
        city_id = re.findall('city_id=(.*?);', cookie, re.S | re.I)[0]
        city_location_id = re.findall('city_location_id=(.*?);', cookie, re.S | re.I)[0]
        location_id = re.findall('location_id=(.*?);', cookie, re.S | re.I)[0]

        return dict(
            wmPoiId=wmPoiId,
            acctId=acctId,
            region_id=region_id,
            region_version=region_version,
            city_id=city_id,
            city_location_id=city_location_id,
            location_id=location_id,
        )
    def get7daysOrder(self,orderDayNum):
        '''
        获取昨日的全部订单
        :return: [] 用户下单时间表
        '''
        ip = {"https": "https://27.154.34.146:39320"}
        ret_data = []
        offset = ""
        get_history_url = "http://e.waimai.meituan.com/v2/order/history/r/query?"
        params_dict = self.get_para_from_mtcookie(self.cookie)
        wmPoiId = params_dict.get('wmPoiId', "")
        region_id = params_dict.get('region_id', "")
        region_version = params_dict.get('region_version', "")
        headers = {
            "Accept": "application/json, text/plain, */*",
            "Sec-Fetch-Mode": "cors",
            "Accept-Language": "zh-CN,zh;q=0.9",
            "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36",
            "X-Requested-With": "XMLHttpRequest",
            "Cookie": self.cookie,
            "Referer": "https://waimaieapp.meituan.com/other/v2/customer/comment"
        }
        # 获取昨天的日期
        def getOrders(daytime,offset,wmPoiId,region_id,region_version,headers):
            res = []
            name_params = {
                "getNewVo": "1",
                "wmOrderPayType": "2",
                "wmOrderStatus": "-2",
                "sortField": "1",
                "startDate": daytime,
                "endDate": daytime,
                "lastLabel": "",
                "nextLabel": "",
                "requestWmPoiId": wmPoiId,
                "region_id": region_id,
                "region_version": region_version,
                "_token": "eJyrViryTFGyMjQAAnMdpdwQJavoWB2lbCidCKVLoHRmXkFpSTGEnVRaUpKfB+UUZ6bnKVkppXpVhISmezo6uqc7BgXa2irpKCWD1BuamlmaWJgaGRkYW5rWAgCY4yEF"
            }
            while True:
                name_params['nextLabel'] = offset
                hist_str = requests.get(get_history_url.format(offset), params=name_params, headers=headers, proxies=self.ip, verify= False).text
                hist_json = json.loads(hist_str)
                for order in hist_json['wmOrderList']:
                    res.append(order['order_time_fmt'])
                if isinstance(hist_json['nextLabel'], dict):
                    num = hist_json['nextLabel']['day_seq']
                    offset = json.dumps({
                        "day": daytime.replace("-", ""),
                        "day_seq": num,
                        "page": 0,
                        "setDay_seq": "true",
                        "setPage": "false",
                        "setDay": "true"
                    })
                else:
                    break
            ret_data.append(res)
        for i in range(orderDayNum,0):
            daytime = datetime.datetime.now() + datetime.timedelta(days=i)
            daytime = daytime.strftime("%Y-%m-%d")
            getOrders(daytime,offset,wmPoiId,region_id,region_version,headers)
        return ret_data
    def get_historyOrder(self):
        '''
        获取昨日的全部订单
        :return: [] 用户下单时间表
        '''
        ret_data = []
        offset = ""
        get_history_url = "http://e.waimai.meituan.com/v2/order/history/r/query?"
        params_dict = self.get_para_from_mtcookie(self.cookie)
        wmPoiId = params_dict.get('wmPoiId', "")
        region_id = params_dict.get('region_id', "")
        region_version = params_dict.get('region_version', "")

        # 获取昨天的日期
        today = datetime.date.today()
        oneday = datetime.timedelta(days=1)
        yesterday = today - oneday
        # yesterday = yesterday - oneday
        yesterday = str(yesterday.strftime('%Y-%m-%d'))

        headers = {
            "Accept": "application/json, text/plain, */*",
            "Sec-Fetch-Mode": "cors",
            "Accept-Language": "zh-CN,zh;q=0.9",
            "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36",
            "X-Requested-With": "XMLHttpRequest",
            "Cookie": self.cookie,
            "Referer": "https://waimaieapp.meituan.com/other/v2/customer/comment"
        }

        name_params = {
            "getNewVo": "1",
            "wmOrderPayType": "2",
            "wmOrderStatus": "-2",
            "sortField": "1",
            "startDate": yesterday,
            "endDate": yesterday,
            "lastLabel": "",
            "nextLabel": "",
            "requestWmPoiId": wmPoiId,
            "region_id": region_id,
            "region_version": region_version,
            "_token": "eJyrViryTFGyMjQAAnMdpdwQJavoWB2lbCidCKVLoHRmXkFpSTGEnVRaUpKfB+UUZ6bnKVkppXpVhISmezo6uqc7BgXa2irpKCWD1BuamlmaWJgaGRkYW5rWAgCY4yEF"
        }

        while True:
            name_params['nextLabel'] = offset
            hist_str = requests.get(get_history_url.format(offset), params=name_params, headers=headers, proxies=self.ip, verify= False).text
            print(hist_str)
            hist_json = json.loads(hist_str)

            for order in hist_json['wmOrderList']:
                ret_data.append(order['order_time_fmt'])
                # print(order)  # 详细信息
                # print("简略信息: ", order['orderCopyContent'])  # 简略信息
            if isinstance(hist_json['nextLabel'], dict):
                num = hist_json['nextLabel']['day_seq']
                offset = json.dumps({
                    "day": yesterday.replace("-", ""),
                    "day_seq": num,
                    "page": 0,
                    "setDay_seq": "true",
                    "setPage": "false",
                    "setDay": "true"
                })
            else:
                break

        return ret_data
    def getYestodayOrder(self):
        self.headers.update({
            "Accept": "application/json, text/plain, */*",
            "Referer": "https://waimaieapp.meituan.com/bizdata/?_source=PC&token="+self.reqcookie['token']+"&acctId="+self.reqcookie['acctId']+"&wmPoiId="+self.reqcookie['wmPoiId']+"&region_id="+self.reqcookie['region_id']+"&appType=3&fromPoiChange=false"
        })
        params={

            "wmPoiId": self.reqcookie['wmPoiId'],
            "acctId": self.reqcookie['acctId'],
            "recentDays": 1,
            "isSum": 0,
        }
        resp=self.req.get(self.trend_url,params=params,headers=self.headers,cookies=self.reqcookie, proxies=self.ip, verify= False)
        logger.info(resp.text)

        return resp.json()

    def setCustomerPrice(self, price, ip = None):

        headers = {

            "Accept": "application/json, text/plain, */*",
            "Accept-Encoding": "gzip, deflate, br",
            "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
            "Content-Type": "application/x-www-form-urlencoded",
            "Referer": self.api_url+"/ad/v1/pc?_source=PC&token="+self.reqcookie['token']+"&acctId="+self.reqcookie['acctId']+"&wmPoiId="+self.reqcookie['wmPoiId']+"&region_id="+self.reqcookie['region_id']+"&appType=3&fromPoiChange=false",


        }
        params = {
            "acctId": self.reqcookie['acctId'],
            "wmPoiId": self.reqcookie['wmPoiId'],
            "token": self.reqcookie['token'],
            "platform": "0",
            "bizad_cityId": self.reqcookie['location_id'],
            "bizad_second_city_id":self.reqcookie['city_location_id'],
            "bizad_third_city_id": self.reqcookie['location_id'],
            "customerOrient": json.dumps({"newCustomer": str(price), "oldCustomer": 0})

        }
        # if ip:
        #     self.ip = {"https": "https://ldy:ldy@123.@" + ip, "http": "http://ldy:ldy@123.@" + ip}
        ret = requests.post(self.customer_edit_url, data=(params), headers=headers, proxies=self.ip, verify= False)
        rep = ret.json()
        return rep

    def setBaseprice(self,price):
        self.headers.update({
            "Referer": self.api_url + "/ad/v1/pc?_source=PC&token=" + self.reqcookie['token'] + "&acctId=" +
                       self.reqcookie['acctId'] + "&wmPoiId=" + self.reqcookie['wmPoiId'] + "&region_id=" +
                       self.reqcookie['region_id'] + "&appType=3&fromPoiChange=false",

        })
        data = {

            "acctId": self.reqcookie['acctId'],
            "wmPoiId": self.reqcookie['wmPoiId'],
            "token": self.reqcookie['token'],
            "platform": "0",
            "bizad_cityId": self.reqcookie['location_id'],
            "bizad_second_city_id": self.reqcookie['city_location_id'],
            "bizad_third_city_id": self.reqcookie['location_id'],
            "bid":int(price)

        }
        resp=self.req.post(self.ad_baseprice_url,data=data,headers=self.headers,cookies=self.reqcookie, proxies=self.ip, verify= False)
        logger.info(resp.text)

    def changeAdstatus(self,status):
        '''
        开启关闭推广
        :param status: 0 开启，1 关闭
        :return:
        '''
        self.headers.update({
            "Accept-Encoding": "gzip, deflate, br",
            "Accept":"application/json, text/javascript, */*; q=0.01",
            "Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",
            "Referer": self.api_url + "/ad/v1/pc?_source=PC&token=" + self.reqcookie['token'] + "&acctId=" +
                       self.reqcookie['acctId'] + "&wmPoiId=" + self.reqcookie['wmPoiId'] + "&region_id=" +
                       self.reqcookie['region_id'] + "&appType=3&fromPoiChange=false%27",
        })
        data={
            "acctId": self.reqcookie['acctId'],
            "wmPoiId": self.reqcookie['wmPoiId'],
            "token": self.reqcookie['token'],
            "platform": "0",
            "bizad_cityId": self.reqcookie['location_id'],
            "bizad_second_city_id": self.reqcookie['city_location_id'],
            "bizad_third_city_id": self.reqcookie['location_id'],
            "status":str(status),
        }
        logger.debug(data)
        logger.debug(self.ad_status_url)
        resp=self.req.post(self.ad_status_url,data=data,headers=self.headers, proxies=self.ip, verify= False)
        logger.info(resp.text)
        code=resp.json().get("code")
        if not code:return True
        return False

    # def getDetail(self):
    #     '''
    #     获取当前基础价格状态
    #     包含店铺的推广状态 0正在推广，1推广关闭状态
    #     :return:
    #     '''
    #     self.headers['Referer']=self.api_url+"/ad/v1/pc?_source=PC&token="+self.reqcookie['token']+"&acctId="+self.reqcookie['acctId']+"&wmPoiId="+self.reqcookie['wmPoiId']+"&region_id="+self.reqcookie['region_id']+"&appType=3&fromPoiChange=false"
    #     params={
    #
    #         "acctId": self.reqcookie['acctId'],
    #         "wmPoiId": self.reqcookie['wmPoiId'],
    #         "token": self.reqcookie['token'],
    #         "platform": "0",
    #         "bizad_cityId": self.reqcookie['location_id'],
    #         "bizad_second_city_id":self.reqcookie['city_location_id'],
    #         "bizad_third_city_id":self.reqcookie['location_id'],
    #         "_":int(time.time()*1000)
    #
    #     }
    #     resp=self.req.get(self.detail_url,params=params,headers=self.headers, proxies=self.ip, verify= False)
    #     try:
    #         data=resp.json().get("data",{})
    #         return data
    #     except:
    #         return False
    def getDetail(self,ip=None):
        '''
        获取当前基础价格状态
        包含店铺的推广状态 0正在推广，1推广关闭状态
        :return:
        '''
        self.headers['Referer']=self.api_url+"/ad/v1/pc?_source=PC&token="+self.reqcookie['token']+"&acctId="+self.reqcookie['acctId']+"&wmPoiId="+self.reqcookie['wmPoiId']+"&region_id="+self.reqcookie['region_id']+"&appType=3&fromPoiChange=false"
        params={

            "acctId": self.reqcookie['acctId'],
            "wmPoiId": self.reqcookie['wmPoiId'],
            "token": self.reqcookie['token'],
            "platform": "0",
            "bizad_cityId": self.reqcookie['location_id'],
            "bizad_second_city_id":self.reqcookie['city_location_id'],
            "bizad_third_city_id":self.reqcookie['location_id'],
            "_":int(time.time()*1000)

        }
        resp=self.req.get(self.detail_url,params=params,headers=self.headers, proxies=self.ip, verify= False, timeout=2)
        try:
            data=resp.json().get("data",{})
            return data
        except:
            return False
    def getCustomerPrice(self, ip = None):
        '''
        获取新客定向出价
        :return:
        '''
        self.headers.update(dict(
            Referer=self.api_url+"/ad/v1/pc?_source=PC&token="+self.reqcookie['token']+"&acctId="+self.reqcookie['acctId']+"&wmPoiId="+self.reqcookie['wmPoiId']+"&region_id="+self.reqcookie['region_id']+"&appType=3&fromPoiChange=false"))
        params={
            "acctId": self.reqcookie['acctId'],
            "wmPoiId": self.reqcookie['wmPoiId'],
            "token": self.reqcookie['token'],
            "platform": "0",
            "bizad_cityId": self.reqcookie['location_id'],
            "bizad_second_city_id": self.reqcookie['city_location_id'],
            "bizad_third_city_id": self.reqcookie['location_id']
        }
        if ip:
            self.ip = {"https": "https://ldy:ldy@123.@"+ip,"http": "http://ldy:ldy@123.@"+ip}
        resp=self.req.get(self.customer_get_url,params=params,headers=self.headers, proxies=self.ip, verify= False)
        logger.info(resp.text)
        data=resp.json().get("data",{})
        return data
    def getBlance(self):
        '''
        获取用户余额
        :return:
        '''
        self.headers.update(dict(

            Referer=self.api_url + "/ad/v1/pc?_source=PC&token=" + self.reqcookie['token'] + "&acctId=" +
                    self.reqcookie['acctId'] + "&wmPoiId=" + self.reqcookie['wmPoiId'] + "&region_id=" + self.reqcookie[
                        'region_id'] + "&appType=3&fromPoiChange=false"))
        params = {
            "acctId": self.reqcookie['acctId'],
            "wmPoiId": self.reqcookie['wmPoiId'],
            "token": self.reqcookie['token'],
            "platform": "0",
            "bizad_cityId": self.reqcookie['location_id'],
            "bizad_second_city_id": self.reqcookie['city_location_id'],
            "bizad_third_city_id": self.reqcookie['location_id']
        }
        resp=self.req.get(self.ad_blance_url,params=params,headers=self.headers,cookies=self.reqcookie, proxies=self.ip, verify= False)
        logger.info(resp.text)
        data=resp.json().get("data",{})
        balance=data.get("balance",0)
        return balance
    def getTrendList(self,recentDays="7",isSum="1"):
        '''
        获取前一天的或者前七天的入店转换或者下单转换速率数据
        :param recentDays: "0"或者是"7"
        :param isSum:
        :return:
        '''
        self.headers.update(dict(
            Referer=self.api_url + "/bizdata?_source=PC&token=" + self.reqcookie['token'] + "&acctId=" +
                    self.reqcookie['acctId'] + "&wmPoiId=" + self.reqcookie['wmPoiId'] + "&region_id=" + self.reqcookie[
                        'region_id'] + "&device_uuid="+ self.reqcookie['device_uuid'] + "&appType=3&fromPoiChange=false"))
        params = {
            "acctId": self.reqcookie['acctId'],
            "wmPoiId": self.reqcookie['wmPoiId'],
            "recentDays":recentDays,
            "isSum":isSum
        }
        resp = self.req.get(self.ad_trendList_url, params=params, headers=self.headers, proxies=self.ip, verify= False)
        logger.info(resp.text)
        data = resp.json().get("data", {})
        return data

    def getShopRealTimeOrder(self):
        '''获取有效订单以及昨日有效订单，以及营业额'''
        # http://e.waimai.meituan.com/v2/index/r/businessOverview?region_id=1000320300&region_version=1522825782
        self.headers.update(dict(
            Referer=self.base_url + "/v2/index?"+"region_id=" + self.reqcookie[
                'region_id'] + "&region_version" + self.reqcookie['region_version']))
        params = {
            "region_id": self.reqcookie['region_id'],
            "region_version": self.reqcookie['region_version'],
        }
        resp = self.req.get(self.ad_realTime_order, params=params, headers=self.headers, proxies=self.ip, verify= False)
        logger.info(resp.text)
        data = resp.json().get("data", {})
        return data
        #https://waimaieapp.meituan.com/bizdata/flowanalysisV3/flow/trendList?wmPoiId=3808654&acctId=31831468&recentDays=0&isSum=1
        #https://waimaieapp.meituan.com/bizdata/flowanalysisV3/flow/trendList?wmPoiId=3808654&acctId=31831468&recentDays=7&isSum=1

    def todayOverView(self):
        self.headers.update(dict(
            Referer=self.api_url + "/bizdata?_source=PC&token=" + self.reqcookie['token'] + "&acctId=" +
                    self.reqcookie['acctId'] + "&wmPoiId=" + self.reqcookie['wmPoiId'] + "&region_id=" + self.reqcookie[
                        'region_id'] + "&device_uuid=" + self.reqcookie[
                        'device_uuid'] + "&appType=3&fromPoiChange=false"))
        params = {
            "wmPoiId": self.reqcookie['wmPoiId'],
        }
        resp = self.req.get(self.todayOverView_url, params=params, headers=self.headers, proxies=self.ip, verify= False)
        logger.info(resp.text)
        data = resp.json().get("data", {})
        return data

    def getExposure(self):

        self.headers.update(dict(
            Referer=self.api_url + "/bizdata?_source=PC&token=" + self.reqcookie['token'] + "&acctId=" +
                    self.reqcookie['acctId'] + "&wmPoiId=" + self.reqcookie['wmPoiId'] + "&region_id=" + self.reqcookie[
                        'region_id'] + "&device_uuid=" + self.reqcookie[
                        'device_uuid'] + "&appType=3&fromPoiChange=false"))
        params = {
            "acctId": self.reqcookie['acctId'],
            "wmPoiId": self.reqcookie['wmPoiId'],
            "recentDays": "0",
            "isSum": "1"
        }
        resp = self.req.get(self.exposure_all_url, params=params, headers=self.headers, proxies=self.ip, verify= False)
        logger.info(resp.text)
        data = resp.json().get("data", {})
        return data
    def getRealTimeOrder(self):
        '''获取有效订单以及昨日有效订单，以及营业额'''
        # https://waimaieapp.meituan.com/bizdata/businessStatisticsV3/single/todayOverview?wmPoiId=3808654
        self.headers.update(dict(
            Referer=self.base_url + "/v2/order/pre?"+"region_id=" + self.reqcookie[
                'region_id'] + "&region_version" + self.reqcookie['region_version']))
        params = {
            "requestWmPoiId":-1,
            "region_id": self.reqcookie['region_id'],
            "region_version": self.reqcookie['region_version'],
        }
        resp = self.req.get(self.realTime_order_url, params=params, headers=self.headers, proxies=self.ip, verify= False)
        logger.info(resp.text)
        data = resp.json().get("data", {})
        return data
    #https://waimaieapp.meituan.com/ad/v3/statistics/cpc/history/info?acctId=31831468&wmPoiId=3808654&token=0ih0GScOhQ672vS2qcHtn2rSuTIyxP0HRjlYGK2eH_zs*&platform=0&bizad_cityId=320322&bizad_second_city_id=320300&bizad_third_city_id=320322&days=7&_=1570793088248
    def getAvgSevenShopInfo(self):
        self.headers.update(dict(
            Referer=self.api_url + "/bizdata?_source=PC&token=" + self.reqcookie['token'] + "&acctId=" +
                    self.reqcookie['acctId'] + "&wmPoiId=" + self.reqcookie['wmPoiId'] + "&region_id=" + self.reqcookie[
                        'region_id'] + "&device_uuid=" + self.reqcookie[
                        'device_uuid'] + "&appType=3&fromPoiChange=false"))
        params = {
            "acctId": self.reqcookie['acctId'],
            "wmPoiId": self.reqcookie['wmPoiId'],
            "token": self.reqcookie['token'],
            "platform": "0",
            "bizad_cityId": self.reqcookie['location_id'],
            "bizad_second_city_id": self.reqcookie['city_location_id'],
            "bizad_third_city_id": self.reqcookie['location_id'],
            "days":7,
            "_": int(time.time() * 1000)
        }
        resp = self.req.get(self.avg_seven_shop_info_usrl, params=params, headers=self.headers, proxies=self.ip, verify= False)
        logger.info(resp.text)
        data = resp.json().get("data", {})
        return data

    def getThirtyDayShopInfo(self):
        self.headers.update(dict(
            Referer=self.api_url + "/bizdata?_source=PC&token=" + self.reqcookie['token'] + "&acctId=" +
                    self.reqcookie['acctId'] + "&wmPoiId=" + self.reqcookie['wmPoiId'] + "&region_id=" + self.reqcookie[
                        'region_id'] + "&device_uuid=" + self.reqcookie[
                        'device_uuid'] + "&appType=3&fromPoiChange=false"))
        params = {
            "acctId": self.reqcookie['acctId'],
            "wmPoiId": self.reqcookie['wmPoiId'],
            "token": self.reqcookie['token'],
            "platform": "0",
            "bizad_cityId": self.reqcookie['location_id'],
            "bizad_second_city_id": self.reqcookie['city_location_id'],
            "bizad_third_city_id": self.reqcookie['location_id'],
            "days":30,
            "_": int(time.time() * 1000)
        }
        resp = self.req.get(self.avg_seven_shop_info_usrl, params=params, headers=self.headers, proxies=self.ip, verify= False)
        logger.info(resp.text)
        data = resp.json().get("data", {})
        return data

    def setBudget(self, price):
        self.headers.update({
            "Referer": self.api_url + "/ad/v1/pc?_source=PC&token=" + self.reqcookie['token'] + "&acctId=" +
                       self.reqcookie['acctId'] + "&wmPoiId=" + self.reqcookie['wmPoiId'] + "&region_id=" +
                       self.reqcookie['region_id'] + "&device_uuid=" + self.reqcookie[
                           'device_uuid'] + "&appType=3&fromPoiChange=false",

        })
        data = {

            "acctId": self.reqcookie['acctId'],
            "wmPoiId": self.reqcookie['wmPoiId'],
            "token": self.reqcookie['token'],
            "platform": "0",
            "bizad_cityId": self.reqcookie['location_id'],
            "bizad_second_city_id": self.reqcookie['city_location_id'],
            "bizad_third_city_id": self.reqcookie['location_id'],
            "budget": int(price)

        }
        resp = self.req.post(self.setBudget_url, data=data, headers=self.headers, cookies=self.reqcookie, proxies=self.ip, verify= False)
        logger.info(resp.text)
    def commentSummary(self):
        """
        获取商家评分的接口
        :return:
        """
        self.headers.update(dict(
            Referer=self.api_url + "/other/v2/customer/comment?_source=PC&token=" + self.reqcookie['token'] + "&acctId=" +
                    self.reqcookie['acctId'] + "&wmPoiId=" + self.reqcookie['wmPoiId'] + "&region_id=" + self.reqcookie[
                        'region_id'] + "&device_uuid=" + self.reqcookie[
                        'device_uuid'] + "&bsid=&appType=3&fromPoiChange=false"))
        """https://waimaieapp.meituan.com/other/v2/customer/comment?_source=PC&token=0yQa1LakCCBvbgRsZnXgU5NJSpEBYx6j0GmtP8IQhSKM*&acctId=31831468&wmPoiId=3808654&region_id=1000320300&device_uuid=!8c7cca83-45b1-45b3-9055-47db557df1b8&bsid=&appType=3&fromPoiChange=false"""
        params = {
            "acctId": self.reqcookie['acctId'],
            "wmPoiId": self.reqcookie['wmPoiId'],
        }
        resp = self.req.get(self.commentSummary_url, params=params, headers=self.headers, proxies=self.ip, verify= False)
        try:
            logger.info(resp.text)
            data = resp.json().get("data", {})
        except:
            data = False
        return data

    def getActivity(self,status="1,8",pageNum = 1 ,pageSize=10):
        """
        获取各种状态的活动
        :param status:1、'1,8'代表进行中
        :param pageNum:第几页
        :param pageSize:每页活动数量
        :return:
        """
        self.headers.update(dict(
            Referer=self.api_url + "/igate/wmactpc/my?_source=PC&token=" + self.reqcookie['token'] + "&acctId=" +
                    self.reqcookie['acctId'] + "&wmPoiId=" + self.reqcookie['wmPoiId'] + "&region_id=" + self.reqcookie[
                        'region_id'] + "&device_uuid=" + self.reqcookie[
                        'device_uuid'] + "&appType=3&fromPoiChange=false"))
        params = {
            "wmPoiId": self.reqcookie['wmPoiId'],
            "status": status,
            "pageNum": pageNum,
            "pageSize": pageSize
        }
        resp = self.req.get(self.activityQuery_url, params=params, headers=self.headers, proxies=self.ip, verify= False)
        try:
            logger.info(resp.text)
            data = resp.json().get("data", {})
        except:
            data = False
        return data

    def customerManageV3NewOldView(self,dateType=1,beginDate=20190912,endDate=20191210):
        """
        新老客占比
        :param dateType:
        :param beginDate:
        :param endDate:
        :return:
        """
        self.headers.update(dict(
            Referer=self.api_url + "/bizdata/?_source=PC&token=" + self.reqcookie['token'] + "&acctId=" +
                    self.reqcookie['acctId'] + "&wmPoiId=" + self.reqcookie['wmPoiId'] + "&region_id=" + self.reqcookie[
                        'region_id'] + "&device_uuid=" + self.reqcookie[
                        'device_uuid'] + "&bsid=&appType=3&fromPoiChange=false"))
        params = {
            "dateType": dateType,
            "beginDate": beginDate,
            "endDate": endDate,
            "wmPoiId": self.reqcookie['wmPoiId'],
            "appType": 3
        }
        resp = self.req.get(self.customerManageV3NewOldView_url, params=params, headers=self.headers, proxies=self.ip, verify= False)
        try:
            logger.info(resp.text)
            data = resp.json().get("data", {})
        except:
            data = False
        return data

    def customerManageV3(self,dateType=2,beginDate = '20190916', endDate = '20191215'):
        """
        复购率
        :param dateType:
        :param beginDate:
        :param endDate:
        :return:
        """
        self.headers.update(dict(
            Referer=self.api_url + "/bizdata/?_source=PC&token=" + self.reqcookie['token'] + "&acctId=" +
                    self.reqcookie['acctId'] + "&wmPoiId=" + self.reqcookie['wmPoiId'] + "&region_id=" + self.reqcookie[
                        'region_id'] + "&device_uuid=" + self.reqcookie[
                        'device_uuid'] + "&bsid=&appType=3&fromPoiChange=false"))
        params = {
            "dateType": dateType,
            "beginDate": beginDate,
            "endDate": endDate,
            "wmPoiId": self.reqcookie['wmPoiId'],
            "appType": 3
        }
        resp = self.req.get(self.customerManageV3_url, params=params, headers=self.headers, proxies=self.ip, verify= False)
        try:
            logger.info(resp.text)
            data = resp.json().get("data", {})
        except:
            data = False
        return data

    def commentList(self,pageNum=2,startDate='2019-12-08',endDate='2019-12-10'):
        """
        顾客的评论
        :param pageNum:
        :param startDate:
        :param endDate:
        :return:
        """
        self.headers.update(dict(
            Referer=self.api_url + "/bizdata/?_source=PC&token=" + self.reqcookie['token'] + "&acctId=" +
                    self.reqcookie['acctId'] + "&wmPoiId=" + self.reqcookie['wmPoiId'] + "&region_id=" + self.reqcookie[
                        'region_id'] + "&device_uuid=" + self.reqcookie[
                        'device_uuid'] + "&bsid=&appType=3&fromPoiChange=false"))
        params = {
            "acctId": self.reqcookie['acctId'],
            "wmPoiId": self.reqcookie['wmPoiId'],
            "token": self.reqcookie['token'],
            "rate": -1,
            "reply": -1,
            "context": -1,
            "startDate": startDate,
            "endDate": endDate,
            "commentKeyWord":"",
            "pageNum": pageNum,
        }
        resp = self.req.get(self.commentList_url, params=params, headers=self.headers, proxies=self.ip, verify= False)
        try:
            logger.info(resp.text)
            data = resp.json().get("data", {})
        except:
            data = False
        return data

    def exposureInfo(self,recentDays='1'):
        """
        顾客来源
        :param recentDays:昨日，最近七天的来源
        :return:
        """
        self.headers.update(dict(
            Referer=self.api_url + "/bizdata/?_source=PC&token=" + self.reqcookie['token'] + "&acctId=" +
                    self.reqcookie['acctId'] + "&wmPoiId=" + self.reqcookie['wmPoiId'] + "&region_id=" + self.reqcookie[
                        'region_id'] + "&device_uuid=" + self.reqcookie[
                        'device_uuid'] + "&bsid=&appType=3&fromPoiChange=false"))
        params = {
            "acctId": self.reqcookie['acctId'],
            "wmPoiId": self.reqcookie['wmPoiId'],
            "recentDays": recentDays
        }
        resp = self.req.get(self.exposureInfo_url, params=params, headers=self.headers, proxies=self.ip, verify= False)
        try:
            logger.info(resp.text)
            data = resp.json().get("data", {})
        except:
            data = False
        return data

    def shopSpuList(self,tagId='',tagName='',pageSize=30,pageNum=1,needAllCount=True,needTagList=True,queryCount=2):
        """
        下架商品
        :param tagId:
        :param tagName:
        :param pageSize:
        :param pageNum:
        :param needAllCount:
        :param needTagList:
        :param queryCount:
        :return:
        """
        self.headers.update(dict(
            Referer=self.base_url + "/reuse/product/food/r/foodListView?" + "&wmPoiId" + self.reqcookie['wmPoiId']))
        params = {
            "wmPoiId": self.reqcookie['wmPoiId'],
        }
        resp = self.req.get(self.shopSpuList_url, params=params, headers=self.headers, proxies=self.ip, verify= False)
        try:
            logger.info(resp.text)
            data = resp.json().get("data", {})
        except:
            data = False
        return data

    def getShopRank(self):
        """
        商铺同商圈排名
        :return:
        """
        self.headers.update(dict(
            Referer=self.base_url + "/v2/index?" + "&region_id=" + self.reqcookie[
                        'region_id'] + "&region_version=" + self.reqcookie[
                        'region_version']))
        params = {
            "region_id": self.reqcookie['region_id'],
            "region_version": self.reqcookie['region_version'],
        }
        resp = self.req.get(self.shopRank_url, params=params, headers=self.headers, proxies=self.ip, verify= False)
        try:
            logger.info(resp.text)
            data = resp.json().get("data", {})
        except:
            data = False
        return data

if __name__=="__main__":
    cookie='device_uuid=!fd927a35-e06f-4c3e-86d4-909db1509e3d;uuid_update=true;wpush_server_url=wss://wpush.meituan.com;shopCategory=food;acctId=57564008;brandId=-1;wmPoiId=7203116;isOfflineSelfOpen=0;city_id=130300;isChain=0;existBrandPoi=false;ignore_set_router_proxy=false;region_id=1000130300;region_version=1559528075;newCategory=false;cityId=510100;provinceId=510000;city_location_id=130300;location_id=130302;pushToken=0dUjTyHFHQpa8xbKOgwtJA7UXg33n5UnZGG4Gyq0OaAw*;setPrivacyTime=3_20190801;token=0bwXIGZQZw00wA_x07_sRhQWzsesJsfOPuaTqZWVk1LM*;set_info=%7B%22wmPoiId%22%3A7203116%2C%22region_id%22%3A%221000130300%22%2C%22region_version%22%3A1559528075%7D;LX_SC_CONSTANT=c_nehoktcu;JSESSIONID=1gr7bzn0pbk251dcrdwuwto9i'
    cookie='device_uuid=!f634f6e1-e4e3-4ca4-8ed1-84777b90babe;uuid_update=true;wpush_server_url=wss://wpush.meituan.com;_lxsdk_cuid=16c4846edd6c8-0be38f37a8b354-37677c05-fa000-16c4846edd6c8;_lxsdk=16c4846edd6c8-0be38f37a8b354-37677c05-fa000-16c4846edd6c8;uuid=8e74abb8400e46145d5f.1564580704.1.0.0;acctId=31831468;brandId=-1;wmPoiId=3808654;isOfflineSelfOpen=0;city_id=320322;isChain=0;existBrandPoi=false;ignore_set_router_proxy=false;region_id=1000320300;region_version=1522825782;newCategory=false;logistics_support=1;cityId=130100;provinceId=130000;city_location_id=320300;location_id=320322;pushToken=0nPU5HTOcf2EYz16iZj25XGcRiFpGhzeZaobIWqoWvNM*;token=0ez8y6uloHHgflnh9nXNs7toztuQOLBz3YSr_S9uBWOQ*;set_info=%7B%22wmPoiId%22%3A3808654%2C%22region_id%22%3A%221000320300%22%2C%22region_version%22%3A1522825782%7D;setPrivacyTime=7_20190801;shopCategory=food;JSESSIONID=sdz9hqigib4eng0xbq25jdcv;_lxsdk_s=16c5ae2372a-287-606-b81%7C%7CNaN'
    mt=MTSpider(cookie)
    mt.getOverView()

